package com.ala4.oxcafe.entity;

import com.ala4.oxcafe.core.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 用户角色关联表
 *
 * @author PING
 * @version 1.0.0
 * @date 2025/8/12 17:57
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("user_role_rel")
@Schema(description = "用户角色关联表")
public class UserRoleRel extends BaseEntity {

    @Schema(description = "主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(message = "ID不能为空", groups = {RoleInfo.Update.class})
    private Long id;

    @Schema(description = "用户ID")
    private Long userId;

    @Schema(description = "角色ID")
    private Long roleId;

    public UserRoleRel() {
    }

    public UserRoleRel(Long userId, Long roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }
}
